
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh-CN">
<head>
    <title>springMVC 用户管理</title>
</head>
<body>
<h1 align="center">博客系统-用户管理</h1>
<hr/>
<h3>所有用户
    <a href="/add">添加</a></h3>

<!-- 如果用户列表为空 -->
<c:if test="${empty userList}">
    <div class="alert alert-warning" role="alert">
        <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>User表为空，请<a href="/add" type="button" class="btn btn-primary btn-sm">添加</a>
    </div>
</c:if>

<!-- 如果用户列表非空 -->
<c:if test="${!empty userList}">
    <table align="center" border="1">
        <tr>
            <th>ID</th>
            <th>昵称</th>
            <th>密码</th>
            <th>操作</th>
        </tr>

        <c:forEach items="${userList}" var="user">
            <tr>
                <td>${user.id}</td>
                <td>${user.name}</td>
                <td>${user.password}</td>
                <td>
                    <a href="/users/show/${user.id}" >详情</a>
                    <a href="/users/update/${user.id}" >修改</a>
                    <a href="/users/delete/${user.id}" onclick="return confirm('您确定要删除吗?')">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</c:if>
</div>

<a href="head">返回上一页</a>
</body>
</html>
